package top.chmin.project.cloud.common.entity;

import java.math.BigDecimal;

/**
 * chmin
 * 2023/12/19 13:33
 * cloud-builder
 */
public abstract class BigDecimalEPCField<T extends PreCondition> {

    T t;
    String columnName;
    BigDecimal value;

    public BigDecimalEPCField(T t, String columnName, BigDecimal value) {
        this.t = t;
        this.columnName = columnName;
        this.value = value;
    }

    public T eq() {
        t.addSql(columnName + " = ?", value);
        return t;
    }

    public T ne() {
        t.addSql(columnName + " <> ?", value);
        return t;
    }

    public T lt() {
        t.addSql(columnName + " < ?", value);
        return t;
    }

    public T gt() {
        t.addSql(columnName + " > ?", value);
        return t;
    }

    public T le() {
        t.addSql(columnName + " <= ?", value);
        return t;
    }

    public T ge() {
        t.addSql(columnName + " >= ?", value);
        return t;
    }

    public T group() {
        t.addGroup(columnName);
        return t;
    }

    public T asc() {
        t.addOrder(columnName);
        return t;
    }

    public T desc() {
        t.addOrder(columnName + " DESC");
        return t;
    }

}
